﻿using AutoMapper;
using SupplierCustomerManagement.Domain.Entities;
using SupplierCustomerManagement.Read.API.Applications.Commands.suppliers;
using SupplierCustomerManagement.Read.API.Applications.Commands.bankaccounts;
using SupplierCustomerManagement.Read.API.Applications.Commands.servicepersonals;
using SupplierCustomerManagement.Read.API.Dtos;
using SupplierCustomerManagement.Domain.ReportForms;

namespace SupplierCustomerManagement.Read.API.Automappers
{
    public class AutomapperProfiles: Profile
    {
        public AutomapperProfiles()
        {
            // 供应商实体到供应商列表DTO的映射
            CreateMap<Supplier, SupplierListDto>()
                .ForMember(dest => dest.CreatedBy, opt => opt.MapFrom(src => src.CreatedBy.ToString()));

            // 供应商实体到供应商详细信息DTO的映射
            CreateMap<Supplier, SupplierDetailDto>()
                .ForMember(dest => dest.CreatedBy, opt => opt.MapFrom(src => src.CreatedBy.ToString()));

            // 银行账户实体到银行账户列表DTO的映射
            CreateMap<BankAccount, BankAccountListDto>();

            // 服务人员实体到服务人员列表DTO的映射
            CreateMap<ServicePersonnel, ServicePersonalListDto>();

            // 供应商联系人实体到供应商联系人列表DTO的映射
            CreateMap<SupplierContact, SupplierContactListDto>();

            // 附件实体到附件列表DTO的映射
            CreateMap<Attachment, AttachmentListDto>();

            // 客户实体到客户列表DTO的映射
            CreateMap<Customer, CustomerListDto>()
                .ForMember(dest => dest.CreatedBy, opt => opt.MapFrom(src => src.CreatedBy.ToString()));

            // 客户实体到客户详细信息DTO的映射
            CreateMap<Customer, CustomerDetailDto>()
                .ForMember(dest => dest.CreatedBy, opt => opt.MapFrom(src => src.CreatedBy.ToString()));

            // 存栏统计汇总实体到列表DTO的映射
            CreateMap<SheepInventorySummary, SheepInventorySummaryListDto>();
        }

    }
}
